﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MultipleChoice_ExamGenerator
{
    public partial class Show_Answers : Form
    {
        public Show_Answers()
        {
            InitializeComponent();
        }

        private void answersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.answersBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.multiplechoicedbDataSet);

        }

        private void Show_Answers_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'multiplechoicedbDataSet.questions' table. You can move, or remove it, as needed.
            this.questionsTableAdapter.Fill(this.multiplechoicedbDataSet.questions);
            int questionID = Convert.ToInt32(Tag);

            this.answersTableAdapter.FillByQID(this.multiplechoicedbDataSet.answers, questionID);
            answerImage();
                       
        }

        private void correctCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            answerImage();
        }

        private void answerImage()
        {

            if (correctCheckBox.Checked)
            {
                correctCheckBox.Image = Properties.Resources.correctAnswer;
            }
            else
                correctCheckBox.Image = Properties.Resources.wrongAnswer;
        }

    }

}